package com.portal.cwegportal.mapper;

import com.portal.cwegportal.input.publicationannouncement.GetHomePagePublicationAnnouncementInput;
import com.portal.cwegportal.model.PublicationAnnouncement;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


@org.apache.ibatis.annotations.Mapper
@Repository
public interface PublicationAnnouncementMapper  extends Mapper<PublicationAnnouncement>{

    @Select("select distinct p.* from publication_announcement p inner join release_scope r on r.key_id=p.id where p.is_deleted=0 and p.status=1 and INSTR(#{orgPathIDs},r.publishing_department_id ) and r.publish_type=p.publish_type  and p.publish_type=#{publishType} order by p.gmt_create desc limit #{limit} ")
    List<PublicationAnnouncement> selectBylimit(GetHomePagePublicationAnnouncementInput input);

    @Select("select distinct p.* from publication_announcement p inner join release_scope r on r.key_id=p.id where p.is_deleted=0 and p.status=1  and p.publish_type=#{publishType} and  r.publish_type=p.publish_type order by p.gmt_create desc limit #{limit} ")
    List<PublicationAnnouncement> selectAdminBylimit(GetHomePagePublicationAnnouncementInput input);
}
